﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
//using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;
using System.Data.SQLite;

namespace BASY
{
    public class SQLhelper
    {
        static System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();
        static int alarmCounter = 1;
        static bool exitFlag = false;
        public static SQLiteConnection Conn//连接
        {
            get
            {
                SQLiteConnection conn = new SQLiteConnection("Data Source=" + Application.StartupPath + "\\xmldb.dll;");
                conn.Open();
                return conn;
            }
        }
        public static SQLiteDataReader GetReader(string sql)
        {
            SQLiteCommand cmd = new SQLiteCommand(sql, Conn);
            SQLiteDataReader reader = cmd.ExecuteReader();
            return reader;
        }
        public int GetSqlcommand(string sql)
        {
            SQLiteCommand cmd = new SQLiteCommand(sql, Conn);
            cmd.ExecuteNonQuery();
            return 0;
        }
        public static DataTable GetdataSet(string sql)
        {
            SQLiteCommand cmd = new SQLiteCommand(sql, Conn);
            SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            return ds.Tables[0];
        }


        internal void GetSqlcommand()
        {
            throw new Exception("The method or operation is not implemented.");
        }

    }
}
